﻿@using CNav.Support
@model CNav.Domain.Admin.FormDesign

@{
    ViewBag.Title = "Form Design - Edit";
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    @Html.HiddenFor(model => model.ID)

    <div id="formDesign">
        <ol>
            <li>
                @Html.HiddenFor(model => model.FormID)
                @Html.LabelFor(model => model.FormName)
                @Html.DisplayFor(model => model.FormName)
            </li>

            <li>
                @Html.LabelFor(model => model.ControlType, "ControlType")
                @Html.DropDownList("ControlType", String.Empty)
                <br />
                @Html.ValidationMessageFor(model => model.ControlType)
            </li>

            <li>
                @Html.LabelFor(model => model.ControlName)
                @Html.EditorFor(model => model.ControlName)
                <br />
                @Html.ValidationMessageFor(model => model.ControlName)
            </li>
            <li>
                @Html.LabelFor(model => model.LabelText)
                @Html.EditorFor(model => model.LabelText)
                <br />
                @Html.ValidationMessageFor(model => model.LabelText)
            </li>
            <li>
                @Html.LabelFor(model => model.DisplayOrder)
                @Html.EditorFor(model => model.DisplayOrder)
                <br />
                @Html.ValidationMessageFor(model => model.DisplayOrder)
            </li>
            <li>
                @Html.Label("Data")
                @Html.DropDownList("DataSourceID", String.Empty)<input type="button" value="Create" class="smallButton" id="createButton" />
                <br />
                @Html.ValidationMessageFor(model => model.DataSourceID)
            </li>
            
             <li>
                <label>&nbsp;</label>
                <input type="submit" value="Save" />
                <input type="button" value="Cancel" id="cancelButton" />
            </li>

        </ol>
    </div>

}

<script type="text/javascript">
    $(document).ready(function () {

        var cc = new CaseCentre();
        cc.BindCancel('#cancelButton', '@Url.Content("~/FormDesign/")' + '@Session[Constant.FormId]');
        cc.BindButton('#createButton', '@Url.Content("~/DataSource/Create")');
    });
</script>
